]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
gdm: Flip canRetry boolean to doneTrying on verification failure
authorRay Strode <rstrode@redhat.com>
Wed, 28 Apr 2021 14:42:14 +0000 (10:42 -0400)
committerMarge Bot <marge-bot@gnome.org>
Wed, 28 Apr 2021 17:23:01 +0000 (17:23 +0000)
This commit flips a boolean in the verification failed handler
to make things easier to read.

It also moves the retry logic to the bottom where it makes more
logical sense.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1821>

js/gdm/util.js

index 1ee84acde287a233b098dbd01f8f34ac076a3507..cb70c285f538afddbf027a9d787706a4df277c48 100644 (file)
@@ -685,29 +685,18 @@ var ShellUserVerifier = class {
             (this._reauthOnly || this._failCounter < this.allowedFailures);
     }
 
-    _verificationFailed(serviceName, retry) {
+    _verificationFailed(serviceName, shouldRetry) {
         // For Not Listed / enterprise logins, immediately reset
         // the dialog
         // Otherwise, when in login mode we allow ALLOWED_FAILURES attempts.
         // After that, we go back to the welcome screen.
-
-        const canRetry = retry && this._canRetry();
-
         this._disconnectSignals();
+
         this._filterServiceMessages(serviceName, MessageType.ERROR);
 
-        if (canRetry) {
-            if (!this.hasPendingMessages) {
-                this._retry(serviceName);
-            } else {
-                const cancellable = this._cancellable;
-                let signalId = this.connect('no-more-messages', () => {
-                    this.disconnect(signalId);
-                    if (!cancellable.is_cancelled())
-                        this._retry(serviceName);
-                });
-            }
-        } else {
+        const doneTrying = !shouldRetry || !this._canRetry();
+
+        if (doneTrying) {
             // eslint-disable-next-line no-lonely-if
             if (!this.hasPendingMessages) {
                 this._cancelAndReset();
@@ -721,7 +710,18 @@ var ShellUserVerifier = class {
             }
         }
 
-        this.emit('verification-failed', serviceName, canRetry);
+        this.emit('verification-failed', serviceName, !doneTrying);
+
+        if (!this.hasPendingMessages) {
+            this._retry(serviceName);
+        } else {
+            const cancellable = this._cancellable;
+            let signalId = this.connect('no-more-messages', () => {
+                this.disconnect(signalId);
+                if (!cancellable.is_cancelled())
+                    this._retry(serviceName);
+            });
+        }
     }
 
     _onServiceUnavailable(_client, serviceName, errorMessage) {